from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from django.views.static import serve
from django.conf import settings
from utils.captcha import CaptchaAPIView
from utils.qiniu_token import GetQiNiuTokenView

router = routers.SimpleRouter()
router.register(r'qiniu_token/admin', GetQiNiuTokenView, 'qiniu_token')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('media/<path:path>', serve, {'document_root': settings.MEDIA_ROOT}),
    path('api/captcha/', CaptchaAPIView.as_view()),
    path('api/admins/', include('admins.urls')),
    path('api/menu/', include('menu.urls')),
    path('api/department/', include('department.urls')),
    path('api/role/', include('role.urls')),
    path('api/config/', include('config.urls')),
    path('api/sort/', include('sort.urls')),
    path('api/article/', include('article.urls')),
    path('api/record/', include('record.urls')),
    path('api/', include(router.urls)),
]
